﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NetDon.Utilities;
namespace NetDon.OA.Portal.Components
{
    public partial class ComanyDepartment : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void ddlCompany_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ddlCompany.SelectedValue != string.Empty)
            {
                this.ddlDepartment.LoadDepartments(this.ddlCompany.SelectedValue.ToGuid());
            }
            else
            {
                this.ddlDepartment.Items.Clear();

            }
        }
        public string CompanyId
        {
            get { return this.ddlCompany.SelectedValue; }
            set
            {
                this.ddlCompany.SelectedValue = value;
                if (this.ddlCompany.SelectedValue != string.Empty)
                {
                    this.ddlDepartment.LoadDepartments(this.ddlCompany.SelectedValue.ToGuid());
                }
                else
                {
                    this.ddlDepartment.Items.Clear();

                }
            }
        }

        public bool EnableCompanyId
        {
            get { return ddlCompany.Enabled; }
            set
            {
                ddlCompany.Enabled = value;
            }
        }
        public bool EnableDepartmentId
        {
            get { return ddlDepartment.Enabled; }
            set { ddlDepartment.Enabled = value; }
        }
        public string DepartmentId
        {
            get { return this.ddlDepartment.SelectedValue; }
            set { this.ddlDepartment.SelectedValue = value; }
        }
    }
}